//
//  ViewController.m
//  30302
//
//  Created by student on 16/3/18.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    UITouch *touch=touches.anyObject;
    if(touch.tapCount>=2)
    {
        CGPoint p=[touch locationInView:self.view];
        CALayer *layer=[CALayer layer];
        layer.frame=CGRectMake(p.x-25, p.y-25, 50, 50);
        layer.backgroundColor=[UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:arc4random_uniform(255)/255.0].CGColor;
        [self.view.layer addSublayer:layer];
    }
}
@end
